<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>职位申请详情</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <include file="Index/common_css"/>
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <style type="text/css">
        .width{
            width: 200px;
        }
    </style>
    <script src="../../../../Public/common/js/layer_show.js"></script>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>职位申请详情</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-3 control-label width">mt4账号：</label>
                            <label class="col-sm-3 control-label">{$data.mt4}</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label width">用户名：</label>
                            <label class="col-sm-3 control-label">{$data.user_name}</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label width">用户邮箱：</label>
                            <label class="col-sm-3 control-label">{$data.user_email}</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label width">当前杠杆：</label>
                            <label class="col-sm-3 control-label">{$data['current_lever']}</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label width">申请杠杆：</label>
                            <label class="col-sm-3 control-label">{$data['apply_lever']}</label>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label width">申请时间：</label>
                            <label class="col-sm-3 control-label">{$data.apply_time}</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label width">处理时间：</label>
                            <label class="col-sm-3 control-label">{$data.hand_time}</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label width">状态：</label>
                            <label class="col-sm-3 control-label">{$data.state}</label>
                        </div>
                        <if condition="$data.status eq 3">
                            <div class="form-group">
                                <label class="col-sm-3 control-label width">拒绝理由：</label>
                                <label class="col-sm-3 control-label">{$data.refuse}</label>
                            </div>
                        </if>


                        <div class="form-group">
                            <div class="col-sm-offset-3 col-sm-8">
                                <button  class="btn btn-sm btn-info" type="button" onclick="layer_close();">返回</button>
                                <if condition="$data.status eq 1">
                                    <a style="margin-left: 80px;" data-toggle="modal" class="btn btn-success" onclick="lever_applyOk(this,'{$data.mt4}');">同意申请</a>
                                    <a style="margin-left: 80px;" data-toggle="modal" class="btn btn-danger" href="intoGold_OneData.html#modal-form">拒绝申请</a>
                                </if>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!--弹出层》-->
<div id="modal-form" class="modal fade" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-6 b-r">
                        <h3 class="m-t-none m-b">请填写拒绝理由</h3>
                        <form role="form">
                            <div class="form-group">
                                <label>拒绝理由：</label>
                                <input type="text" id="refuse" class="form-control" />
                            </div>

                            <div>
                                <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="button" onclick="Lever_refuse(this,'{$data.id}');"><strong>确认</strong>
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<include file="Index/common_js"/>
<!-- Peity -->
<script src="__PUBLIC__/admin/js/plugins/peity/jquery.peity.min.js"></script>
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script src="__PUBLIC__/common/js/layer_show.js"></script>
<script>
    var index;
    function lever_applyOk(obj,mt4) {
        var id = '{$data.id}'; //
        var email = '{$data.user_email}';
        var lever ='{$data[\'apply_lever\']}';
        if(id=='' || email==''|| mt4=='' ||lever==''){
            layer.msg("没有获取到信息，请刷新页面再试");return false;
        }else{
            index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
            $.ajax({
                type:"POST",
                url:"__MODULE__/Apply/lever_agree",
                dataType:'json',
                data:{mt4:mt4,id:id,email:email,lever:lever},
                success:function(data){
                    //console.log(data);
                    //alert(JSON.stringify(data));return;
                    layer.close(index);
                    if(data.status==1){
                        layer.msg(data.msg);
                        setTimeout(function () {location.reload();}, 1000);
                    }else if(data.status==0){
                        layer.msg(data.msg,{icon: 2, time: 2000});
                    }else{
                        layer.msg('网络错误',{icon: 2, time: 2000});
                    }
                },error:function(err){
                    //console.log(err);
                    layer.close(index);
                    layer.msg('网络错误',{icon: 2, time: 2000});
                }
            });
        }
    }
    function Lever_refuse(obj,id) {
        var mt4 = '{$data.mt4}';
        var email = '{$data.user_email}';
        var refuse = $("#refuse").val();
        if(id=='' || email==''|| mt4=='' ||refuse==''){
            layer.msg("请确保信息完整");return false;
        }else{
            index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
            $.ajax({
                type:"POST",
                url:"__MODULE__/Apply/lever_refuse",
                dataType:'json',
                data:{mt4:mt4,id:id,email:email,refuse:refuse},
                success:function(data){
                    //console.log(data);
                    //alert(JSON.stringify(data));return;
                    layer.close(index);
                    if(data.status==1){
                        layer.msg(data.msg);
                        setTimeout(function () {location.reload();}, 1000);
                    }else if(data.status==0){
                        layer.msg(data.msg,{icon: 2, time: 2000});
                    }else{
                        layer.msg('网络错误',{icon: 2, time: 2000});
                    }
                },error:function(err){
                    //console.log(err);
                    layer.close(index);
                    layer.msg('网络错误',{icon: 2, time: 2000});
                }
            });
        }
    }
</script>
</body>
</html>
